<!--
 * @Description:
 * @Author: cgt
 * @Date: 2021-12-23 14:05:56
 * @LastEditors: cgt
 * @LastEditTime: 2021-12-28 20:00:06
-->
<template>
  <div>
    <el-button @click="drawCircle">画圆</el-button>
    <el-button @click="drawRect">画矩形</el-button>
    <el-button @click="drawPolygon">画多边形</el-button>
    <el-button @click="clear">清空</el-button>
  </div>
</template>

<script>
import mixins from '../mixins';
export default {
  name: 'SelectTool',
  props: {
    getTool: {
      type: Function,
      required: true
    }
  },
  mixins: [mixins],
  data() {
    return {};
  },
  methods: {
    drawCircle() {
      this.getTool('SelectTool').active('circle', (geometry) => {
        console.log(geometry);
      });
    },
    drawRect() {
      this.getTool('SelectTool').active('rect', (geometry, e) => {
        console.log(geometry, e);
      });
    },
    drawPolygon() {
      this.getTool('SelectTool').active('polygon', (geometry) => {
        console.log(geometry);
      });
    },
    clear() {
      this.getTool('SelectTool').clear();
    }
  }
};
</script>

<style scoped></style>